home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Miscellaneous
/
Headlines Code
/
Headlines Project ƒ
/
HeadlinesMain.h
< prev
next >
Wrap
Text File
|
1992-11-07
|
3KB
|
126 lines
/*
* Headlines.h
*
*/
/******************************/
#pragma once
/******************************/
#include <JADG.h>
#include <JRandom.h>
/******************************/
enum {
kSpeedControl = 0,
kColorControl
} ;
#define kMaxNFonts (4)
enum {
unknownErr = 1024,
expectedClassDefnErr,
expectedClassInstanceErr,
tooManyClassesErr,
badClassHeaderErr,
badLineWeightErr,
noHeadlinesErr,
noMainClassErr,
storageAlreadyInitedErr,
noFontInfoErr,
badFontInfoErr,
retryDisplayErr
} ;
#define kMaxNClasses (300L)
#define kMaxNCharsPerLine (256)
#define kMaxNBytesInDef (2000L)
#define kMaxNTags (50)
/******************************/
typedef struct def_struct {
short cumul;
char *str;
struct def_struct *next;
} defn;
/*
* Within a definition, names of subdefinitions are bracketed in BSLASH
* and SLASH chars. Definitions are null-terminated. The SLASH char is
* always followed by a variant tag (the default is " ").
*/
#define BSLASH ('\\')
#define SLASH ('/')
#define VBAR ('|')
/* These are here so that I don't confuse the poor Balancer. */
#define LBRACE ('{')
#define RBRACE ('}')
/*
* Note that THINK C's object extensions must be turned off to use the
* name "class," which is otherwise a keyword.
*/
typedef struct {
short weight;
defn *list;
char *name;
char *tags;
} class;
/******************************/
/* A global for the storage, so I don't have to keep passing it around. */
extern Handle *gStorage;
/* The input resource (corresponds to "InFile"), its mark, and its length. */
extern char **gInRsrcHndl;
extern long gInRsrcMark;
extern long gInRsrcLength;
/* Is a headline currently being displayed? */
extern Boolean gHeadlineIsUp;
/* The time at which the last headline was displayed or removed. */
extern unsigned long gLastActionTicks;
/* The current line being read in. */
extern char gInLine[kMaxNCharsPerLine];
/* How many classes there are. */
extern short gNClasses;
/* A pointer to the array of class records. */
extern class *gClass;
/* The default tags (shared). */
extern char gNullTags[];
/* The ID of class MAIN. */
extern short gCompMain;
/* The data for JRandom. */
extern jrStruct gJR;
/* The headline that will be, is, or was being displayed. */
extern Str255 gHeadline;
#define jPutChar(c) ( gHeadline[ ++gHeadline[0] ] = (c) )
/* The bastardized "class" that contains font and style information. */
extern class gFontClass;
/******************************/
extern Boolean gHasFreedHeadlinesAllocations;
extern void freeHeadlinesAllocations(void);
extern void freeHeadlinesAllocationsIfErr(OSErr theOSErr);